package com.app.couponsharelife.data.bean

import android.os.Parcel
import android.os.Parcelable

/**
 *Created by xct on 2019/1/10
 *Description:
 */
data class LifeBaseBean(
    var centerBanner: List<CenterBanner> =arrayListOf(),
    var classify: List<Classify> =arrayListOf(),
    var topBanner: List<LifeTopBanner> =arrayListOf(),
    var tradingArea: List<TradingArea> =arrayListOf()
)

data class CenterBanner(
    var beginTime: Any?,
    var createTime: String="",
    var endTime: Any?,
    var favoritesId: Int?,
    var id: Int?,
    var imgPath: String="",
    var jumpType: String="",
    var link: String="",
    var sort: Int?,
    var status: Int?,
    var type: String=""
)

data class LifeTopBanner(
    var beginTime: String="",
    var createTime: String="",
    var endTime: String="",
    var favoritesId: Int?,
    var id: Int?,
    var imgPath: String="",
    var jumpType: String="",
    var link: String="",
    var sort: Int?,
    var status: Int?,
    var type: String=""
)

data class Classify(
    var createTime: String="",
    var englishName: String="",
    var id: Int?,
    var name: String="",
    var parentId: Int?,
    var picUrl: String="",
    var sort: Int?
)

data class TradingArea(
        var address: String = "",
        var cityId: Int = 0,
        var createTime: String = "",
        var id: Int = 0,
        var latitude: String = "",
        var longitude: String = "",
        var name: String = "",
        var parentId: Int = 0,
        var picUrl: String = "",
        var provinceId: Long = 0,
        var sort: Int = 0
) : Parcelable {
    constructor(source: Parcel) : this(
            source.readString()!!,
            source.readInt(),
            source.readString()!!,
            source.readInt(),
            source.readString()!!,
            source.readString()!!,
            source.readString()!!,
            source.readInt(),
            source.readString()!!,
            source.readLong(),
            source.readInt()
    )

    override fun describeContents() = 0

    override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
        writeString(address)
        writeInt(cityId)
        writeString(createTime)
        writeInt(id)
        writeString(latitude)
        writeString(longitude)
        writeString(name)
        writeInt(parentId)
        writeString(picUrl)
        writeLong(provinceId)
        writeInt(sort)
    }

    companion object {
        @JvmField
        val CREATOR: Parcelable.Creator<TradingArea> = object : Parcelable.Creator<TradingArea> {
            override fun createFromParcel(source: Parcel): TradingArea = TradingArea(source)
            override fun newArray(size: Int): Array<TradingArea?> = arrayOfNulls(size)
        }
    }
}